<?php

use Illuminate\Support\Facades\Route;

/*
 * |--------------------------------------------------------------------------
 * | Web Routes
 * |--------------------------------------------------------------------------
 * |
 * | Here is where you can register web routes for your application. These
 * | routes are loaded by the RouteServiceProvider within a group which
 * | contains the "web" middleware group. Now create something great!
 * |
 */

// Auth::routes();
Route::group([
    'namespace' => 'Auth'
], function () {
    Route::get('login', 'LoginController@showLoginForm')->name('login');
    Route::post('login', 'LoginController@login');

    Route::group([
        'middleware' => ['auth', 'auth.user.config']
    ], function () {
        // 退出
        Route::post('logout', 'LoginController@logout')->name('logout');
        // 密码重置路由
        Route::get('pwd/reset', 'ResetPwdController@showResetForm')->name('pwd.request');
        Route::post('pwd/reset', 'ResetPwdController@reset')->name('pwd.update');
    });
});

Route::get('/', 'AdminController@index')->middleware(['auth', 'auth.user.config', 'auth.reset.pwd'])->name('admin');



Route::group([
    'namespace' => 'Game\Data'
], function () {
    Route::get('game/detail/{token}', 'SettlementController@detail');
});

// Exports【游戏】
Route::group([
    'prefix' => 'game',
    'namespace' => 'Game'
], function () {

    // 玩家管理
    Route::group([
        'prefix' => 'user',
        'middleware' => 'can:menu.game.user'
    ], function () {
        Route::get('export', 'UserController@export');
    });

    // 数据
    Route::group([
        'prefix' => 'data',
        'namespace' => 'Data'
    ], function () {
        // 游戏记录
        Route::group([
            'prefix' => 'settlement',
            'middleware' => 'can:menu.game.data.settlement'
        ], function () {
            Route::get('export', 'SettlementController@export');
        });
    });
});
